
from django.db.models import IntegerField, ForeignKey, BooleanField,CharField, TextField, ManyToManyField, CASCADE

from apps.vadmin.op_drf.models import CoreModel


class Comp_User(CoreModel):

    name = CharField(max_length=40, verbose_name="姓名")
    email = CharField(max_length=255, verbose_name="邮箱", null=True, blank=True)
    mobile = CharField(max_length=255, verbose_name="电话", null=True, blank=True)
    # avatar = TextField(verbose_name="头像", null=True, blank=True)
    # name = CharField(max_length=40, verbose_name="姓名")
    gender = CharField(max_length=8, verbose_name="性别", null=True, blank=True)
    remark = TextField(verbose_name="备注", null=True)
    is_staff = BooleanField(verbose_name="客户是否在职", default=True, null=True)
    posts = CharField(max_length=128, verbose_name='职位', blank=True, null=True)
    # user_type = IntegerField(default=0, verbose_name="用户类型")
    # post = ManyToManyField(to='permission.Post', verbose_name='关联岗位', db_constraint=False)
    # role = ManyToManyField(to='permission.Role', verbose_name='关联角色', db_constraint=False)
    dept = ForeignKey(to='permission.Dept', verbose_name='归属部门', on_delete=CASCADE, db_constraint=False, null=True,
                      blank=True)



    class Meta:
        verbose_name = '角色管理'
        verbose_name_plural = verbose_name

    def __str__(self):
        return f"{self.name}"
